package cn.melonlib.apis.support.model.entity;

import cn.melonlib.cores.commons.model.entity.TenantRecordEntity;
import cn.melonlib.cores.model.anno.ModelComment;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;

@Data
@EqualsAndHashCode(callSuper = true)
@Entity(name = "RestRequestRecord")
@Table(name = "apis_rest_request_record")
@ModelComment("REST请求日志")
public class RestRequestRecord extends TenantRecordEntity {

    @ModelComment("请求地址")
    private String url;

    @ModelComment("请求参数")
    private String params;

    @ModelComment("请求正文类型描述")
    private String requestContentType;

    @ModelComment("请求类型")
    private String method;

    @ModelComment("客户端类型")
    @Column(length = 1000)
    private String clientInfo;

    @ModelComment("响应正文")
    @Column
    @Lob
    @Basic(fetch = FetchType.LAZY)
    private String response;

    @ModelComment("响应状态代码")
    private Integer responseCode;

    @ModelComment("响应正文长度")
    private Long contentLength;

    @ModelComment("响应时间")
    private Long responseDateTime;

    @ModelComment("请求消耗时间")
    private Long useTime;
}
